package com.zjw.spring.service;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import com.zjw.spring.dao.UserDao;
import com.zjw.spring.model.Person;

@Service
public class UserServiceImpl implements UserService {
	
//	@Autowired
//	@Resource()
	private UserDao userDao;
	
	public UserServiceImpl(){
		super();
	}
	
	@Autowired //constructor inject,injected byType,
			    //if the container have more than one matched type,
				//must use the @Qualifier to specify
	public UserServiceImpl(@Qualifier("userDaoJdbcImpl")UserDao userDao){
		this.userDao = userDao;
	}

	/*@Autowired
	@Qualifier("userDaoJdbcImpl")
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}*/

	@Override
	public void addUser(Person person) {
		userDao.addUser(person);
		System.out.println("UserServiceImpl.addUser executed...");
	}

}
